Skip to main content

imageCacheLimit

Type

property

Summary

Sets the size of memory that is used to cache all decompressed image data.

Syntax

set the imageCacheLimit to <theCacheLimit>
get the imageCacheLimit

Description

Use the imageCacheLimit to specify how much memory should be used to cache all decompressed image data. The default limit for mobile devices is 67108864 byte (64 MB) and 268435456 byte (256 MB) for all other platforms.

In the event of running out or memory, the image cache operates a least-recently-used policy. This means that if an image needs to be decompressed and there is not sufficient cache space, then the images that have not been used for the longest time are discarded until there is sufficient space to add the new image.

If an image has the alwaysBuffer property set to true, then it is decompressed into the cache on card open. Images are processed from lowest layer to highest. If the number of images with the alwaysBuffer property set to true exceed the cache size, then images on lower layers are removed from the cache before images higher up the layers.

An image can be forced to be cached by using the prepare image command.

The image cache is keyed on the absolute filename of image thus it is highly efficient to use image objects referencing the same filename, rather than buttons referencing icons. In particular, there is only one decompressed set of image data for a given (absolute) filename in the cache at any one time.

note

The transformed image data of rotated and scaled images is cached, but images do not share this transformed data.

Examples

set the imageCacheLimit to 33554432
get the imageCacheLimit

command: prepare image

property: alwaysBuffer, imageCacheUsage

Compatibility and Support

Introduced

LiveCode 6.0.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?